<?php
if (!defined("_INDEX")) { header("Location: /"); die; }

$id = UV::readInt(strip_tags($route->POST("id")));

$query = "select `name`,`link`,`reliability_id`,`order`,`about` from `companies` where `company_id` = '$id' limit 1";
$data = $db->getRow($query);

$query = "select `service_id` from `providers` where `company_id` = '$id' order by `provider_id`";
$services = $db->getColumn($query);

$info = "{\"name\":\"".str_replace("\"","\\\"",str_replace("\r","\\\\r",str_replace("\n","\\\\n",$data['name'])))."\",
	\"link\":\"$data[link]\",
	\"reliability\":\"$data[reliability_id]\",
	\"order\":\"$data[order]\",
	\"about\":\"".str_replace("\"","\\\"",str_replace("\r","\\\\r",str_replace("\n","\\\\n",$data['about'])))."\",
	\"services\":[".implode(",",$services)."]}";

echo $info;

?>